package Work0604;

import java.io.*;

public class RandomAcessFileTest {

	public static void main(String[] args) throws Exception {
		String path = "C:\\Users\\Y\\Desktop\\北大青鸟课件\\北大青鸟作业\\test.txt";
		RandomAccessFile ran = new RandomAccessFile(new File(path), "r");
		System.out.println("输入内容:" + ran.getFilePointer());
		ran.seek(10);
		byte[] b = new byte[10];
		int hasRead = 0;
		while ((hasRead = ran.read(b)) > 0) {
			System.out.println(new String(b, 0, hasRead));
		}
		ran.close();

	}

}
